apiready = function(){


api.addEventListener({
    	name:'keyback'
	}, function(ret, err){        
	     dialogBox_alert1_order()
	});
	
	headerstatus()	

	var width = api.winWidth;
	var header = $api.byId('header');
	var nav = $api.byId('oneBtnBuy');
 	var navPos = $api.offset(nav);
	var headerPos = $api.offset(header);
	var height = api.winHeight - headerPos.h - navPos.h;
    api.openFrame({
    name: 'orderContent',
    url: './orderContent.html',
   	rect:{
			x: 0,
            y: headerPos.h,
            w: width,
            h: height
		},
    pageParam: {
        name: 'test'
    },
    bounces: false,
    bgColor: 'rgba(0,0,0,0)',
    vScrollBarEnabled: true,
    hScrollBarEnabled: true
});

}

	
	

function submit(){
	
     api.execScript({
        frameName: 'orderContent',
        script: 'getData()'
    });
}

//dialogoreder
function dialogBox_alert1_order() {
  		var dialogBox = api.require('dialogBox');
    dialogBox.alert({
        texts : {
            content : '你离宝贝可能只有一步之遥，确定要放弃？',
            leftBtnTitle : '放弃支付',
            rightBtnTitle : '继续支付'
        },
        styles : {
            bg : '#fff',
            corner : 6,
            w : 300,
           
            content : {
                color : '#000',
                size : 16
            },
            left : {
                marginB : 20,
                marginL : 20,
                w : 120,
                h : 35,
                corner : 2,
                color : "#fff",
                bg : '#c6c6c6',
                size : 16
            },
            right : {
                marginB : 20,
                marginL : 20,
                w : 120,
                h : 35,
                corner : 2,
                color : "#fff",
                bg : '#FF0000',
                size : 16
            }
        },
        tapClose : true
    }, function(ret) {
        if (ret.eventType == 'left') {
            dialogBox.close({
                dialogName: 'alert'
            });
            $api.rmStorage('ShoppingCart')
            $api.setStorage('cartNum',0);
            api.execScript({
                name:'root',
                script: 'changeNum()'
            });
            api.execScript({
                name:'detail',
                script: 'changeNum()'
            });
            addCart('')
            api.closeWin();
                    
            
        }else{
	        dialogBox.close({
	                dialogName: 'alert'
	            });
	        	
        }
    });
}
